// class 
// ?占쎌룞?占썲뜝?占쎌삕 action query ?占쎌룞?占썲뜝占� 
CActionHelper = function() {

	this.name = 'ActionHelper: ';
	this.prevDA_index	= 0;

	// define sol num 
	this.solnum = {} ;
	this.solnum.sp = 2;
	this.solnum.lanu = 8;
	this.solnum.ov = 15;
	this.solnum.k = 17;



// for test 
this.resinfoidx = 0;

	// cit 
	this.maxcit = 5;
	this.cit = new Array(this.maxcit);
};


CActionHelper.prototype = {
	
	initialize: function() {
	},

	processWorldMap: function(worlddata, cb) {
		// console.info( arguments.callee.name );
		em.util.print_status(worlddata);

		var DAarr = this.extractDA(worlddata);

		if ( cb) 
			cb(DAarr);
	},
	
	
	
	worldMap: function(param) {
		console.log(arguments.callee.caller);
		var query = new CQuery();
		query.makeQuery('worldmap');
		query.setCoOdi( param.x, param.y);
		
		query.print();
		this.sendAjaxQuery(query, this.processWorldMap, param, test_worlddata_james);
	},
	

	
	
	
/*
	
	// �잙갭梨뜹뜝�몄뿉�좑옙data ?�좎룞�쇿뜝�쇰맩���곌랬���좑옙  hnt �좎럥흮�좑옙 att param �좎럩�뽩뜝占썹춯節뚭섬??
	processSolEdu: function(data, cb) {
		debug.log(this, retName(this) ," got sol edu data : ", data);
		if (cb) 
			cb(data);
			
	},*/


	solEdu: function(param) {
		var query = new CQuery();
		query.makeQuery('sol_edu');
		query.setCit(param.citnum);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_soldata);
	},	







/*

	processCitInfo: function(data, cb) {
		em.util.print_status(data);
		
		// �좎떬�댿뵛�좎럩裕녶뜝占썲윜諛몄굡�좑옙 data ?�좎룞�쇿윜諛몄굡�좎뜽�먨뜝�숈삕???�곌랬���좑옙
		if (cb) 
			cb(data);
		
	},*/


	/*	[{"id":39545,"itemid":166,"secs":118075}, //23
		{"id":40536,"itemid":166,"secs":462108},
		{"id":40819,"itemid":120,"secs":45057}]
	,0],
	*/
	getCitInfo: function(param) {
		var query = new CQuery();
		query.makeQuery('getcit');
		query.setCit( param.citnum);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_citinfo);
	},	




/*
	get_cdinfo_api.php?
jsonpcallback=jsonp1321974261720&_=1321974470536&key=a0ec2950f34992bd4d5db145cfea95d3
&city=3070
&_l=en
&_p=EW-DROID

*/
/*
		 
{"code":0,
"ret":
	{"cdlist":
		[
			{"id":757395,"cdtype":1,"target":4,"owner":0,"secs":170134},
			{"id":780811,"cdtype":1,"target":9,"owner":0,"secs":504194},
			{"id":805491,"cdtype":0,"target":5,"owner":0,"secs":5220},
			{"id":206987,"cdtype":2,"target":5,"owner":26106,"secs":58628}],
			"grade":62,"money":0}}
*/
	getCDInfo: function(param) {
		var query = new CQuery();
		query.makeQuery('get_cdinfo');
		query.setCit( param.citnum);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_cdinfo);
	},	
	
	
	/*
		&city=23063
&tid=911200
&action=build
&iid=115
	*/
	// use fast 
	get_cdinfo_ap_use_fasti: function(param) {
		var query = new CQuery();
		query.makeQuery('get_cdinfo_ap_use_fasti');
		query.setCit( param.citnum);
		query.setTid( param.tid);
		query.setAction( param.action);
		query.setIid( param.iid);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, {});
	},	








/*
jsonp1322055723838({"code":0,"ret":{"hero":[
{"id":9176,"gid":210,"p":44,"i":8,"c1":17,"f":34,"g":12,"c2":613,"fy":0,"s":0,"e":10,"w":0,"tw":30,"tl":79,
	"ex":59758,"te":257100,"np":0,"ni":0,"nc1":0,"nc2":0,"ns":0,"ncd":0,"pr":36000},
{"id":20635,"gid":185,"p":10,"i":40,"c1":13,"f":50,"g":11,"c2":559,"fy":0,"s":0,"e":10,"w":0,"tw":0,"tl":89,"ex":106717,"te":116863,"np":0,"ni":0,"nc1":0,"nc2":0,"ns":0,"ncd":0,"pr":33000},{"id":24349,"gid":142,"p":18,"i":26,"c1":18,"f":38,"g":4,"c2":354,"fy":0,"s":0,"e":10,"w":1,"tw":12,"tl":7,"ex":398,"te":468,"np":0,"ni":0,"nc1":0,"nc2":0,"ns":0,"ncd":0,"pr":12000},{"id":81059,"gid":200,"p":22,"i":10,"c1":15,"f":50,"g":3,"c2":299,"fy":0,"s":0,"e":10,"w":0,"tw":0,"tl":1,"ex":0,"te":212,"np":0,"ni":0,"nc1":0,"nc2":0,"ns":0,"ncd":0,"pr":9000}]}})
*/

	processCons: function(data, cb) {
		debug.log(this, em.debug.info, retName(this) ," got cons ", data);
		
		var H_arr = data ? data.ret.hero : []  ;
		if (cb) 
			cb(H_arr);

	},

	conscribe: function(param) {
		var query = new CQuery();
		query.makeQuery('conscribe');
		query.setCit( param.citnum);
		query.setExtra( param.extra);		// if no extra : remove extra field in query 
			
		query.print();
		this.sendAjaxQuery(query, this.processCons, param, test_conscribedata[ em.testdata.conscribeindex ]);
		
		
		// fot test case 
		em.testdata.conscribeindex ++;
		
		if ( em.testdata.type != em.testdata.NO_HERO) {
			if (em.testdata.conscribeindex >= test_conscribedata.length -1) 
				em.testdata.conscribeindex = 0
		else {	// until empty hero 
			if (em.testdata.conscribeindex >= test_conscribedata.length ) 
				em.testdata.conscribeindex = 0			
		}
		}
	},	









/*
// GET /game/gen_conscribe_api.php?
jsonpcallback=jsonp1321974261763&_=1321974829879&key=a0ec2950f34992bd4d5db145cfea95d3
&lv=17
&_l=en&_p=EW-DROID HTTP/1.1

*/


/*
	jsonp1321974261763({"code":0,"ret":{"hero":[
	{"id":29358,"gid":67,"g":16,"w":0,"uid":9286,"u":"\uac00\uc8fc","r":2,"gname":"\uace0\uad6c\ub824","gflag":11},
	{"id":51292,"gid":16,"g":16,"w":0,"uid":8984,"u":"sharon","r":2,"gname":"\uace0\uad6c\ub824","gflag":11},
	{"id":29041,"gid":59,"g":16,"w":0,"uid":5095,"u":"\ube5b","r":1,"gname":"\uba85\uc608","gflag":127},
	{"id":29683,"gid":87,"g":17,"w":2,"uid":14787,"u":"\uae30\uc2b5\ubf40","r":1,"gname":"\uace0\uad6c\ub824","gflag":11},
	{"id":34773,"gid":26,"g":17,"w":2,"uid":13165,"u":"zicl","r":2,"gname":"\ud3c9\ud654","gflag":104},
	{"id":59881,"gid":26,"g":17,"w":0,"uid":7151,"u":"alexpark","r":2,"gname":"\uc5d4\uc824","gflag":34},
	{"id":30287,"gid":46,"g":16,"w":0,"uid":12572,"u":"kalgus","r":2,"gname":"\uace0\uad6c\ub824","gflag":11},
	{"id":47245,"gid":121,"g":16,"w":6,"uid":2398,"u":"\uc2f8\uc774\ubb38","r":2,"gname":"","gflag":1},
	{"id":29978,"gid":88,"g":16,"w":5,"uid":5095,"u":"\ube5b","r":1,"gname":"\uba85\uc608","gflag":127},
	{"id":42950,"gid":10,"g":17,"w":0,"uid":5601,"u":"\ud5ec\uce74","r":2,"gname":"\uace0\uad6c\ub824","gflag":11}]}})
*/

	arena_conscribe: function(param) {
		var query = new CQuery();
		query.makeQuery('arena_conscribe');
		query.setLv( param.lv);
			
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_arena_ret_cons);
	},	











/*
	GET /game/gen_conscribe_api.php?
	jsonpcallback=jsonp1321974261764&_=1321974841416&key=a0ec2950f34992bd4d5db145cfea95d3
	&gid=30679
	&tgid=29358
	&_l=en&_p=EW-DROID HTTP/1.1

*/

	arena_battle_conscribe: function(param) {
		var query = new CQuery();
		query.makeQuery('arena_battle_conscribe');
		query.setGid(param.gid );		// tani
		query.setTGid(param.tgid);		// mantis00
			
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_hdrin_conscribe);
	},	




/*
			GET /game/gen_conscribe_api.php?jsonpcallback=jsonp1326014287301&_=1326016407209&key=0314fac3e037989c062370584d3dc99b
			&city=17736
			&action=hire_process
			&_l=en&_p=EW-DROID HTTP/1.1
*/
	gen_conscribe_api: function(param) {
		var query = new CQuery();
		query.makeQuery('gen_conscribe_api');
		query.setCit( param.citnum);
		query.setAction( param.action);
		query.setGid(param.gid );		// tani
		query.setTGid(param.tgid);		// mantis00		
		query.setLv( param.lv);
		query.setExtra( param.extra);		// if no extra : remove extra field in query 		
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_hdrin_conscribe);
	},






	hdrin_conscribe: function(param) {
		var query = new CQuery();
		query.makeQuery('hdrin_conscribe');
		query.setCit( param.citnum);

		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_hdrin_conscribe);
	},



	
	hdrin_action_conscribe: function(param) {
		var query = new CQuery();
		query.makeQuery('hdrin_action_conscribe');
		query.setCit( param.citnum);
		query.setConsAction( param.cons_action);

		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_hdrin_action_processCons);
				

	},



	// test do with 1 func 
	rumor_conscribe: function(param) {
		var query = new CQuery();
		query.makeQuery('rumor_conscribe');
		query.setCit( param.citnum);
		query.setConsAction( param.cons_action);

		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_rumor_conscribe);

	},







/*
		// Sel  co odi 
armament_action_do_api.php?
jsonpcallback=jsonp1322055723836&_=1322055842519&key=3badb54bda7e38920062ad493d1c9944

&city=14281
&act=anum
&x=204&y=251
&_l=en 
*/
	processArmament_set_ta: function(data, cb) {
		// {"code":0,"ret":1}
		// no need to process data 
		debug.log(this, retName(this) ,"  Got Set TA CB: ret : ", data.ret );
		if(em.test){
			// inc att count
			data.ret = (data.ret >= 3 ) ? 0 : data.ret+= 1;
		}
		if ( cb)
			cb(data)
	},
	
	
	armament_action_set_ta: function(param) {
		var query = new CQuery();
		query.makeQuery('armament_set_ta');
		query.setCit( param.citnum);
		query.setCoOdi( param.x, param.y );	

		query.print();
		this.sendAjaxQuery(query, this.processArmament_set_ta, param, test_arma_set_ta);
	},




/*
//  go att 
armament_action_do_api.php?
jsonpcallback=jsonp1322055723839&_=1322055884101&key=3badb54bda7e38920062ad493d1c9944

&city=14281
&action=do_war
&attack_type=7
&gen=185
&area=204&area_x=251
&soldier_num2=33
&_l=en 

*/

	armament_action_att: function(param) {
		var query = new CQuery();
		query.makeQuery('armament_att');
		query.setCit( param.citnum);
		query.setAttType( param.atttype);
		query.setHGenId( param.genid);
		query.setCoOdi( param.x, param.y );
		
		query.setSolNum( param.troops);
		query.setTaiNum( param.tainum); 
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_arma_attdata);
	},	









/*
// go confirm with cost 
 armament_action_task_api.php?
 jsonpcallback=jsonp1322055723840&_=1322055886719&key=3badb54bda7e38920062ad493d1c9944
 
 &city=14281
 &action=war_task
 &attack_type=7
 &gen=185
 &area=204&area_x=251
 &soldier_num2=33
 &_l=en
 &carry=1980&cost_food=1980&cost_wood=0&cost_iron=0&cost_gold=0&distance=2160&travel_sec=300 

{"code":0,"ret":{"cd":[{"id":3321647,"cdtype":4,"target":7,"owner":185,"secs":300,"ret":0,"ext":"204\/251"}]}}
*/
	
	armament_action_att_wcost: function(param) {
		var query = new CQuery();
		query.makeQuery('armament_att_wcost');
		query.setCit( param.citnum);
		query.setAttType( param.atttype);
		query.setHGenId( param.genid);
		query.setCoOdi( param.x, param.y );
		query.setSolNum( param.troops);
		query.setTaiNum( param.tainum );
		query.setCost( param.cost);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_arma_wcostdata);
	},		

 
 


/*
message_api.php?
jsonpcallback=jsonp1321974261721&_=1321974484078&key=a0ec2950f34992bd4d5db145cfea95d3
&page=1
&_l=en
&_p=EW-DROID

jsonp1321974261721(
{"code":0,
"ret":
{"mail":
[
{"id":"473273","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321968210,"new":1},{"id":"471036","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09\uc2dc\uac04 \u2605\u2605","time":1321925649,"new":1},
{"id":"470279","sender":"sys","title":"Famine happens in Castle [185\/53]!","time":1321913471,"new":0},{"id":"469881","sender":"sys","title":"NO Food in Castle [185\/53]!","time":1321889675,"new":1},{"id":"469772","sender":"sys","title":"Eliminated by [Led] adam in PVP","time":1321886003,"new":1},{"id":"468104","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321842417,"new":1},
{"id":"468103","sender":"\uae40\uc120\uc9c4","title":"24\uc77c \ubaa9\uc694\uc77c 18\uc2dc \ud734\uc804\ud574\uc81c","time":1321838344,"new":0},{"id":"467545","sender":"sys","title":"[185\/53]\uc131 \ub0b4\uc5d0 \uc2dd\ub7c9\uc774 \uc5c6\uc2b5\ub2c8\ub2e4!","time":1321829813,"new":1},{"id":"466090","sender":"sys","title":"Resource Colony 4\/72 is expired","time":1321791198,"new":1},{"id":"467552","sender":"\ud751\uc778","title":"\ud751\uc778\ub18d\uc7a5 \uc0ac\uc6a9\ubc29\ubc95","time":1321762518,"new":0},
{"id":"467551","sender":"\ud751\uc778","title":"\ud751\uc778\ub18d\uc7a5 \uc0ac\uc6a9\ubc29\ubc95","time":1321762510,"new":0},{"id":"467550","sender":"\uae40\uc120\uc9c4","title":"\uc0ac\uce6d\uc8fc\uc758","time":1321762288,"new":0},{"id":"467549","sender":"\ud751\uc778","title":"\uc8fc \ud751\uc778\ub18d\uc7a5\uac1c\uc5c5 \uc0ac\uc6a9\ubc29\ubc95","time":1321762278,"new":0},{"id":"467548","sender":"\ud751\uc778","title":"(\uc8fc) \ud751\uc778\ub18d\uc7a5 \uac1c\uc5c5","time":1321762183,"new":0},{"id":"467547","sender":"\ud751\uc778","title":"\ub2e4\ub4e4 \uc218\uc1a1\ud301 \ub2e4\uc2dc-\ucd5c\uc885\uc801","time":1321759625,"new":0},{"id":"467546","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321755594,"new":1},{"id":"462487","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321680488,"new":1},{"id":"462486","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321677413,"new":1},{"id":"462485","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321675795,"new":1},
{"id":"462484","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321675492,"new":1}
],
"max":2}})
*/

	MessageApi: function(param) {
		var query = new CQuery();
		query.makeQuery('messageapi');
		
		query.setPage( param.pagenum);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_messageapi);
	},		



/*

/war_result_list_api.php?
jsonpcallback=jsonp1321974261722&_=1321974489374&key=a0ec2950f34992bd4d5db145cfea95d3
&page=1
&type=3
&_l=en
&_p=EW-DROID

*/


	WResultList: function(param) {
		var query = new CQuery();
		query.makeQuery('wresultlist');
		query.setPage( param.pagenum);
		query.setListType( param.listtype);

		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_wresultlist);
	},		


/*

war_result_info_api.php?
jsonpcallback=jsonp1321974261723&_=1321974497945&key=a0ec2950f34992bd4d5db145cfea95d3
&id=3276196 // id
&_l=en
&_p=EW-DROID

		

// Horror(694)
jsonp1321974261723({
"code":0,
"ret":
{
"war_report":null,
"scout_report":
{"flag":0,
"result":
"<b>[Hero]<\/b><br\/>ChaosSlave (Lvl.3)<br\/><br\/><b>[Troops]<\/b><br\/>Horror(694)<br>Attack(15)&nbsp;&nbsp;Defense(8)&nbsp;&nbsp;Health(80)<br><br>"},
"other_report":null}})
*/

	WReusltInfo: function(param) {
		var query = new CQuery();
		query.makeQuery('wresultinfo');
		query.setMsgid( param.msgid);

		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_wresultinfo[ em.testdata.resinfoidx ]);
		em.testdata.resinfoidx ++; 
	},		
	
	
	/*
			GET /game/api_fav.php?
	jsonpcallback=jsonp1322284134980&_=1322284229576&key=83f3cd5da55f9c02536501a0a7011f52
	&act=getfavnpc
	&cat=2
	&_l=en&_p=EW-DROID HTTP/1.1

	*/
	
	getFavs: function(param) {
		var query = new CQuery();
		query.makeQuery('favs');
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_favsdata);
	},			

/*
		GET /game/api_fav.php?
	jsonpcallback=jsonp1324453113056&_=1324453158117
	&key=49f84472ae46aa1956ec5ab945087e7f
	&act=addreport
	&wid=4145349
	&cat=2
	&_l=en&_p=EW-IPHONE-EN HTTP/1.1

*/
	addFavDA: function(param) {
		var query = new CQuery();
		query.makeQuery('add_fav_da');
		query.setAct(param.act);
		query.setWid(param.wid);
		query.setCat(param.cat);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_add_fav_DA);
	},	
	
	delFavDA: function(param) {
		var query = new CQuery();
		debug.log(this, 'action for dur : ', param );
		query.makeQuery('del_fav_da');
		query.setAct(param.act);
		query.setFId(param.fid);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_add_fav_DA);
	},	





/*
	local_market_api.php?
	jsonpcallback=jsonp1322895150032&_=1322895652255&key=e6dc55e081a118523345c1655b80c549
	&city=22336
	&_l=en&_p=EW-DROID HTTP/1.1

jsonp1322895150032({"code":0,"ret":{"g2w":0.06,"g2f":0.13,"g2i":0.1,"w2g":17,"f2g":80,"i2g":11}})

	*/
	
	localMarket: function(param) {
		var query = new CQuery();
		query.makeQuery('localmarket');
		query.setCit( param.citnum);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_localmarket_data);
	},			


	
	/*
local_market_api.php?
jsonpcallback=jsonp1322895150033&_=1322895663627&key=e6dc55e081a118523345c1655b80c549
&city=22336
&reso_put=giveput
&g2f=7
&_l=en&_p=EW-DROID HTTP/1.1
	*/
	
	localMarket_resput: function(param) {
		var query = new CQuery();
		query.makeQuery('localmarket_resput');
		query.setCit( param.citnum);
		query.setG2f( param.g2f);
		query.setG2w( param.g2w);
		query.setG2i( param.g2i);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_localmarket_resput_data);
	},			
	
// 




// 	 LOGIN ... 
			/*
			GET /info.php?
jsonpcallback=jsonp1323389966359&_=1323389984249
&user=Greateload
&action=login
&pvp=0
&code=e7e8b613d1b08d069751171da8b0eb17fe02ee8c				// iphone kr 
		*/ 
	login_info: function(param) {
		var query = new CQuery();
		query.makeQuery('login_info');
		query.setUser( param.user);
		query.setLoginAction( param.login_action);
		query.setPvp( param.pvp);
		query.setCode( param.device_code);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_login_info);
	},


/*
	GET /game/
login_api.php?
jsonpcallback=jsonp1323389966360&_=1323389985557
&username=Greateload
&password=1212
&_l=kr&_p=EW-IPHONE-KR HTTP/1.1
		
		
jsonp1323389966360(
	{"code":0,"ret":{"key":"b557990e3591188901cb50f1422bc0d4"}})
*/				
	login_api: function(param) {
		var query = new CQuery();
		query.makeQuery('login_api');
		query.setUsername( param.username );
		query.setPassword( param.password);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_login_api_2ndstep);
	},



/*
			GET /game/
get_userinfo_api.php?
jsonpcallback=jsonp1323389966361&_=1323389987156
&key=b557990e3591188901cb50f1422bc0d4
&_l=kr
&_p=EW-IPHONE-KR HTTP/1.1
			
*/
	
	get_userinfo_api: function(param) {
		var query = new CQuery();
		query.makeQuery('get_userinfo_api');
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_userinfo);
	},


/*
	system quest
*/
	 
/*
		GET /game/system_task_api.php?
	jsonpcallback=jsonp1322284134974&_=1322284138231&key=83f3cd5da55f9c02536501a0a7011f52
	&action=task_list
	&_l=en&_p=EW-DROID HTTP/1.1
*/

	system_task_api: function(param) {
		var query = new CQuery();
		query.makeQuery('system_task_api');
		query.setAction( param.action);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_login_api_2ndstep);
	},
	
	/*
		system_task_api.php?jsonpcallback=jsonp1325476678171&_=1325550298428&key=362def183bdae036dc927ebc7d02600a
&action=task_end
&id=49
&_l=en&_p=EW-IPHONE-EN HTTP/1.1
	*/
	

	system_task_conduct: function(param) {
		var query = new CQuery();
		query.makeQuery('system_task_conduct');
		query.setAction( param.action);
		query.setId( param.id);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_login_api_2ndstep);
	},	
	
/*
	======== train 
*/

	soldier_educate_camp: function(param) {
		var query = new CQuery();
		query.makeQuery('soldier_educate_camp');
		query.setCit( param.citnum);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_cons_camp);
	},

				/*
	&city=22478
&action=soldier_educate
&soldier=2
&num=323
&gen=185 // h gid 
				*/	
	soldier_educate_train: function(param) {
		var query = new CQuery();
		query.makeQuery('soldier_educate_train');
		query.setCit(param.citnum);
		query.setAction(param.action);
		query.setSoldier(param.sol);
		
		query.setNum(param.num);
		query.setGen(param.gid);
		
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_cons_train);
	},	


/*
	disband
soldier_educate_api.php?jsonpcallback=jsonp1325725020011&_=1325725041979&key=152ca40a2927f8e42b8ceed4872ee885
&city=10956	
	&action=disband
&soldier_num1=82
*/
	soldier_educate_disband: function(param) {
		var query = new CQuery();
		query.makeQuery('soldier_educate_disband');
		query.setCit(param.citnum);
		query.setAction(param.action);
		query.setSolNum( param.troops);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_cons_train);
	},	

/*
	GET /game/
my_gen_mod_api.php?jsonpcallback=jsonp1323353477776&_=1323362198934&key=7c67cf5bf34d95dbf8c039a067a4619a
&id=87588
&action=give
&city=22478
&golds=1000
&_l=en&_p=EW-DROID HTTP/1.1

jsonp1323353477776({"code":0,"ret":{"fealty":51}})
*/
	genmodapi_give: function(param) {
		var query = new CQuery();
		query.makeQuery('genmodapi_give');
		query.setHid(param.hid);
		query.setAction(param.action);
		query.setCit(param.citnum);
		query.setGolds(param.golds);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_genmodeapi_give);
	},	
/*
	GET //
study_api.php?jsonpcallback=jsonp1323353477723&_=1323353563583&key=7c67cf5bf34d95dbf8c039a067a4619a
&city=22478
&_l=en&_p=EW-DROID HTTP/1.1


jsonp1323353477723({"code":0,"ret":[[1,1,1],[2,1,1],[3,0,1]],"ext":[4,4]})
*/
	study_api: function(param) {
		var query = new CQuery();
		query.makeQuery('study_api');
		query.setCit(param.citnum);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_study_api);
	},	
/*

							GET /game/study_mod_api.php?jsonpcallback=jsonp1323353477767&_=1323361379226&key=7c67cf5bf34d95dbf8c039a067a4619a
&city=22478
&tech=5
&owner=87588
&_l=en&_p=EW-DROID HTTP/1.1

jsonp1323353477767({"code":0,"ret":{
"cdlist":[{"id":221306,"cdtype":2,"target":5,"owner":87588,"secs":907}]}})*/

	study_mod_api: function(param) {
		var query = new CQuery();
		query.makeQuery('study_mod_api');
		query.setCit(param.citnum);
		query.setTech(param.tech);
		query.setOwner(param.owner);		// when owner is 0 .. remove field. 
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_study_api);
	},	

/*
building_create_task_api.php?jsonpcallback=jsonp1323353477781&_=1323362473217&key=7c67cf5bf34d95dbf8c039a067a4619a
&city=22478
&build_type=8
&_l=en&_p=EW-DROID HTTP/1.1
*/

	build_api: function(param) {
		var query = new CQuery();
		query.makeQuery('build_api');
		query.setCit(param.citnum);
		query.setBuildType(param.buildtype);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_build_house);
	},	

/*
	===========  item list 
*/
/*
 * 
 goods_api.php?j
	&action=goods_list
&type=3
&page=1

*/
	goods_api: function(param) {
		var query = new CQuery();
		query.makeQuery('goods_api');
		query.setAction(param.action);
		query.setType(param.type);
		query.setPage(param.page);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_goods_api_list);
	},	
/*
	goods_mod_api.php?jsonpcallback=jsonp1326014287250&_=1326014568812&key=0314fac3e037989c062370584d3dc99b
&action=use
&city=17736
&id=75614
&num=1
*/
	goods_mod_api: function(param) {
		var query = new CQuery();
		query.makeQuery('goods_mod_api');
		query.setAction(param.action);
		query.setCit(param.citnum);
		query.setId(param.id);
		query.setNum(param.num);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_goods_api_list);
	},	

/*
	==========  enhance 
*/

/*
goods_api.php?jsonpcallback=jsonp1325595647958&_=1325654454666&key=362def183bdae036dc927ebc7d02600a
&action=listupdate
&type=1
&_l=en&_p=EW-IPHONE-EN HTTP/1.1
*/

	goods_api_list: function(param) {
		var query = new CQuery();
		query.makeQuery('goods_api_list');
		query.setAction(param.action);
		query.setListType(param.type);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_goods_api_list);
	},	

/*

goods_api.php?jsonpcallback=jsonp1325595647964&_=1325654515562&key=362def183bdae036dc927ebc7d02600a
&city=3070
&id=612505
&action=upgrade
&_l=en&_p=EW-IPHONE-EN HTTP/1.1
*/
	goods_api_upgrade: function(param) {
		var query = new CQuery();
		query.makeQuery('goods_api_upgrade');
		query.setCit(param.citnum);
		query.setId(param.id);
		query.setAction(param.action);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_goods_api_upgrade);
	},	
	
	


/*
	GET /gift.php?jsonpcallback=jsonp1325550691617&_=1325550739615
&user=Greateload
&code=Xpp0is3
&_l=kr&_p=EW-IPHONE-KR HTTP/1.1
*/
	gift: function(param) {
		var query = new CQuery();
		query.makeQuery('gift');
		query.setUser(param.user);
		query.setCode(param.code);
		
		
		query.print();
		var test_gift  = {"code":3202,"ret":""};
		this.sendAjaxQuery(query, param.cb, param, test_gift);
	},	
	

/*
	 fast .. acton
*/

/*
GET /game/api_getcdprice.php?jsonpcallback=jsonp1326636913122&_=1326638589486
&type=1
&secs=551
*/
	api_getcdprice: function(param) {
		var query = new CQuery();
		query.makeQuery('api_getcdprice');
		query.setListType(param.type);
		query.setSecs(param.secs);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, {});
	},	
/*
	 shop : gem 
*/

	sys_shop_api: function(param) {
		var query = new CQuery();
		query.makeQuery('sys_shop_api');
		query.setAction(param.action);
		query.setType(param.type);
		query.setCit(param.citnum);
		query.setId(param.id);
		
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, 
			{"code":0,"ret":
				{"item":[71,68,72,73,69,70],
				"price":[45000,100000,30000,20000,80000,60000],
				"attr":[
				[0,0,0,9,0,0],[0,0,0,18,0,0],[0,0,0,6,0,0],[0,0,0,3,0,0],[0,0,0,15,0,0],[0,0,0,12,0,0]]}}
		);
	},	
	
	sys_shop2_api: function(param) {
		var query = new CQuery();
		query.makeQuery('sys_shop2_api');
		query.setAction(param.action);
		query.setPage(param.page);
		query.setCat(param.cat);
		
		query.setNum(param.num);
		query.setId(param.id);
		
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, 
			{"code":0,"ret":
				{"item":[{"id":112,"p":3},
				{"id":131,"p":20},{"id":166,"p":19},
				{"id":167,"p":59},{"id":128,"p":20},{"id":184,"p":10},
				{"id":162,"p":40},{"id":161,"p":4},{"id":195,"p":199},{"id":0,"p":0}],"max":1}}
		);
	},	
	
	/*
		trade 
	*/
	
	

	
	safe_market_api: function(param) {
		var query = new CQuery();
		query.makeQuery('safe_market_api');
		query.setType(param.type);
		query.setPage(param.page);

		query.setAction(param.action);
		query.setCit(param.citnum);
		query.setId(param.id);

		
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param,	{} );
	},	


	safe_goods_api: function(param) {
		var query = new CQuery();
		query.makeQuery('safe_goods_api');
		query.setAction(param.action);
		query.setCit(param.citnum);
		query.setId(param.id);

		query.setType(param.type);
		query.setPage(param.page);


		query.setSafenum(param.safe_num);
		query.setPrice(param.price);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param,	{} );
	},	
	
	goods_api_fast: function(param) {
		var query = new CQuery();
		query.makeQuery('goods_api_fast');
		query.setIds(param.ids);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param,	{} );
	},	

	
/*

GET /game/api_union.php?jsonpcallback=jsonp1326205755618&_=1326205897076&key=a34882ecc701a8d83ccc9e9e50e747e8
&page=1
&name=greate
&id=262
&tid=1193
&info=a

*/
	api_union: function(param) {
		var query = new CQuery();
		query.makeQuery('api_union');
		query.setPage(param.page);
		query.setName(param.name);
		query.setId(param.id);
		query.setTid(param.tid);
		query.setInfo(param.info);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param,	{} );
	},	
	
	
/*
		api_union_info.php?jsonpcallback=jsonp1325476678152&_=1325550166741&key=362def183bdae036dc927ebc7d02600a
	&op=tdonate
	&num=1000000
	&techid=19
	&city=15584&
	_l=en&_p=EW-IPHONE-EN HTTP/1.1
*/	
	api_union_info: function(param) {
		var query = new CQuery();
		query.makeQuery('api_union_info');
		query.setOp(param.op);
		query.setNum(param.num);
		query.setTechid(param.techid);
		query.setCity(param.city);
		query.setDelid(param.delid);	// quit ally
		
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param,	{} );
	},	
		
	
	
 /*
      ================================================
      ==================
      PVP  loot 
 */

/*
	pvp server specific 
*/
	pvp_get_userinfo_api: function(param) {
		var query = new CQuery();
		query.makeQuery('pvp_get_userinfo_api');
		query.setPushID( param.pushid );
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, data_userinfo);
	},

/*
						armament_action_do_api.php?jsonpcallback=jsonp1325133695667&_=1325133782039&key=73a526d0eac45e84efed99ae86f37408
&city=112
&attack_type=0
&gen=190
&area=19
&area_x=12
&soldier_num11=55
*/


	armament_action_att_pv: function(param) {
		var query = new CQuery();
		query.makeQuery('armament_att_pv');
		query.setCit( param.citnum);
		query.setAttType( param.atttype);
		query.setHGenId( param.genid);
		query.setCoOdi( param.x, param.y );
		
		query.setSolNum( param.troops);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_arma_attdata);		// same as att 
	},	


	armament_action_att_wcost_pv: function(param) {
		var query = new CQuery();
		query.makeQuery('armament_action_att_wcost_pv');
		query.setCit( param.citnum);
		query.setAttType( param.atttype);
		query.setHGenId( param.genid);
		query.setCoOdi( param.x, param.y );
		
		query.setSolNum( param.troops);
				
		query.setCost( param.cost);
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_arma_wcostdata);
	},		


/*
 	// up durability
*/

/*
		GET /game/get_cityinfo_api.php?jsonpcallback=jsonp1325146029253&_=1325156388738
	&key=8a7f773e37c231801a667b84a0fe3ce1
	&city=100
	&action=op_pop

*/
	up_durability_pv: function(param) {
		var query = new CQuery();
		query.makeQuery('up_durability_pv');
		query.setCit( param.citnum);
		query.setAction( param.action);
		debug.log(this, 'action for dur : ', param.action );
		
		query.print();
		this.sendAjaxQuery(query, param.cb, param, test_up_durability_pv);
	},		



	//    do work ...
	sendAjaxQuery: function(query, processfn, param, test_data) {
		var outer = this;	
		
		function data_cb(data)  {
			debug.log(outer,em.debug.info, " got jsonp response :" + query.type, data);
			processfn.apply(outer, [data , param.cb ]);
		};
		
		if ( em.test) { 			
				debug.log(this, query.getType() ," test mode got cb data  ================= TEST ====================" );
				data_cb(test_data);
			return ;		}		
		
		$.ajax({
		 type: "GET",
		 url: query.jsonpurl,
		 data: query.data,
		 dataType: 'jsonp',
		 success: data_cb,
		});				

		// delete query 
		delete query;
	},


	// util function 
	extractDA: function(data) {
			if (data.code != 0 ) {
				debug_log ("fail to get world map data ");
				return;
				}
			
			var mapdata = data.ret.map;
			var DAarr = new Array();
			$.each( mapdata, function ( i, item ) {
					if (  (item[2] >= 1 && item[2] <= 6 ) 
							 ||  ( item[2] == -1  && CDB.getCurUserOptions().pvp )// user  included when pvp 
							  ) {
						// found 
						// debug_log( " DA "  + item[0] + "/ " + item[1]) ;
						DAarr.push(item);
					}
				});
			return DAarr;
		},
};


function trans(str){
//	document.getElementById("unicode").value = replaceAll(escape(str),"%","\\");	
	return replaceAll(escape(str),"%","\\");
}



function detrans(str){
//	var str = document.getElementById("unicode2").value;
//	document.getElementById("hangul2").value = unescape(replaceAll(str,"\\","%"));	
	return unescape(replaceAll(str,"\\","%"));
}

function replaceAll(strTemp, strValue1, strValue2){
    while(1){
        if( strTemp.indexOf(strValue1) != -1 )
            strTemp = strTemp.replace(strValue1, strValue2);
        else
            break;
    }
    return strTemp;
}


// Expert Info (Chat/Sequence): 
// GET /game/api_world_map.php?jsonpcallback=jsonp1322034289959\
// &_=1322034437410
// &key=3badb54bda7e38920062ad493d1c9944
// &x=224&y=250
// &_l=en HTTP/1.1\r\n
/*

jsonp1321974261716(
	{"code":0,"ret":
		{"xleft":178,"yleft":"53","xright":192,"yright":"53","xup":"185","yup":46,"xdown":"185","ydown":60,
		"map":[
			[182,50,-1,[3074,"james!!",2,62,"\uba85\uc608",103,5,127,0,0,21909,"\ucc9c\uacf5\uc131",[0,0,"",5]]],
			[183,50,0,""],
			[184,50,-1,["3073","Lord9558309",1,1,"",0,0,1,0,0,3069,"9558309",[0,0,null]]],
			[185,50,121,[2137,2715,"",""]],
			[186,50,0,""],
			[187,50,3,[7]],[188,50,-1,[3074,"james!!",2,62,"\uba85\uc608",103,5,127,0,0,15584,"\ucc9c\ud654\uc131",[0,0,"",5]]],
			[182,51,0,""],[183,51,0,""],[184,51,-1,[3074,"james!!",2,62,"\uba85\uc608",103,5,127,0,0,17169,"\ucc9c\ud669\uc131",[0,0,"",5]]],[185,51,0,""],[186,51,-1,[3070,"\uad11\uba85",1,13,"",0,0,11,0,0,3066,"\ubd88\uc9c0\uc625",[0,0,null]]],[187,51,0,""],[188,51,0,""],[182,52,-1,["3058","Lord9557732",1,0,"",0,0,1,0,0,3053,"9557732",[0,0,null]]],[183,52,0,""],[184,52,-1,["3068","lordofchoi",2,1,"",0,0,1,0,0,3064,"\u3067\u3083slw",[0,0,null]]],[185,52,0,""],[186,52,121,[2133,2960,"",""]],[187,52,0,""],[188,52,2,[10]],[182,53,-1,[16463,"Lord6494100",3,0,"",0,0,1,0,0,18620,"6494100",[0,0,null,5]]],[183,53,111,[2132,3548,"",""]],[184,53,5,[16]],[185,53,-1,[3074,"james!!",2,62,"\uba85\uc608",103,5,127,0,0,3070,"\ucc9c\uc0c1\uc131",[0,0,"",5]]],[186,53,0,""],[187,53,0,""],[188,53,121,[2136,2609,"",""]],[182,54,0,""],[183,54,0,""],[184,54,-1,[3074,"james!!",2,62,"\uba85\uc608",103,5,127,0,0,14798,"\ucc9c\uc911\uc131",[0,0,"",5]]],[185,54,0,""],[186,54,-1,[3072,"Lord9558299",1,0,"",0,0,1,0,0,3068,"9558299",[0,0,null]]],[187,54,-1,["3071","Lord9558298",1,0,"",0,0,1,0,0,3067,"9558298",[0,0,null]]],[188,54,-1,[3066,"Lord9557996",2,0,"",0,0,1,0,0,3062,"9557996",[0,0,null,5]]],[182,55,-1,["3062","Lord9557806",2,0,"",0,0,1,0,0,3056,"9557806",[0,0,null]]],[183,55,0,""],[184,55,-1,["3069","Lord9558224",2,0,"",0,0,1,0,0,3065,"9558224",[0,0,null]]],[185,55,0,""],[186,55,111,[2135,3232,"",""]],[187,55,0,""],[188,55,0,""],[182,56,2,[21]],[183,56,0,""],[184,56,0,""],[185,56,0,""],[186,56,0,""],[187,56,111,[2134,3227,"",""]],[188,56,-1,[3074,"james!!",2,62,"\uba85\uc608",103,5,127,0,0,15072,"\ucc9c\ud558\uc131",[0,0,"",5]]]]}})
*/

// 222/ 252 : 3 star 4 
// 224/ 253  :4 start 29


// /soldier_educate_api.php?jsonpcallback=jsonp1321974261717&_=1321974450455
//&key=a0ec2950f34992bd4d5db145cfea95d3
//&city=3070&_l=en&_p=EW-DROID

/*
2: sp
8 : lanu
15 : ov
17: k
jsonp1321974261717(
{"code":0,
"ret":
{"soldiers":
[[1,0,1],[2,121,1],[3,0,1],[4,0,1],[5,0,1],[6,0,1],[7,0,1],[8,1528,1],[9,0,1],[10,12,1],[11,0,1],[12,0,1],[13,0,1],[14,0,1],[15,2077,1],[16,0,1],[17,2699,1],[18,1,1]],
"space":6562,"head":8356,"def":1,"next":[0,0],"f":-38261}})
*/




/*  : scan !! 
 armament_action_do_api.php?
 jsonpcallback=jsonp1321974261718&_=1321974460167&key=a0ec2950f34992bd4d5db145cfea95d3
 &city=3070
 &action=do_war
 &attack_type=3
 &tai_num=3
 &area=184&area_x=53
 &_l=en
 &_p=EW-DROID


jsonp1321974261718(
{"code":0,
"ret":
{"carry":180,"cost_food":180,"cost_wood":0,"cost_iron":0,"cost_gold":0,"distance":2040,"travel_sec":0}})
*/



/*

get_cityinfo_api.php?
jsonpcallback=jsonp1321974267349&_=1321974460196&key=a0ec2950f34992bd4d5db145cfea95d3
&city=3070
&_l=en
&_p=EW-DROID


2 : remain area
192 : area
484741,21213527,2915768,21213527,220137,21213527,1075887,21213527,  : resource  cur / max
9652,9644, : popul
5,5,5,29, :  farm
18,26,24,22,13,24,18,  : structure   town, bar, wall, arena, storage,  research, fucility

jsonp1321974267349(
{"code":0,
"ret":
{"city":
[2,193,
	484741,21213527,2915768,21213527,220137,21213527,1075887,21213527, //9
	9652,9644, 	//11
	5,5,5,29,		//15
	18,26,24,22,13,24,18,   // 22
	[{"id":39545,"itemid":166,"secs":118075}, //23
		{"id":40536,"itemid":166,"secs":462108},
		{"id":40819,"itemid":120,"secs":45057}]
	,0],
	"grade":62,"money":0}
}
)
*/


/*
 //   scan send !!
 armament_action_task_api.php?
 jsonpcallback=jsonp1321974261719&_=1321974468658&key=a0ec2950f34992bd4d5db145cfea95d3
 &city=3070
	 &action=war_task
 &attack_type=3&tai_num=3
 	&area=184&area_x=53
 &_l=en
 &_p=EW-DROID
 &carry=180&cost_food=180&cost_wood=0&cost_iron=0&cost_gold=0&distance=2040&travel_sec=0


jsonp1321974261719(
{"code":0,
"ret":
	{"cd":
	[{"id":3281779,"cdtype":4,"target":3,"owner":0,"secs":0,"ret":0,"ext":"184\/53"}]
	}
}
)

*/



/*
get_cdinfo_api.php?
jsonpcallback=jsonp1321974261720&_=1321974470536&key=a0ec2950f34992bd4d5db145cfea95d3
&city=3070
&_l=en
&_p=EW-DROID


jsonp1321974261720(
{"code":0,
"ret":
	{"cdlist":
		[
			{"id":757395,"cdtype":1,"target":4,"owner":0,"secs":170134},
			{"id":780811,"cdtype":1,"target":9,"owner":0,"secs":504194},
			{"id":805491,"cdtype":0,"target":5,"owner":0,"secs":5220},
			{"id":206987,"cdtype":2,"target":5,"owner":26106,"secs":58628}],
			"grade":62,"money":0}}
)
*/


/*
message_api.php?
jsonpcallback=jsonp1321974261721&_=1321974484078&key=a0ec2950f34992bd4d5db145cfea95d3
&page=1
&_l=en
&_p=EW-DROID


jsonp1321974261721(
{"code":0,
"ret":
	{"mail":
		[
			{"id":"473273","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321968210,"new":1},{"id":"471036","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09\uc2dc\uac04 \u2605\u2605","time":1321925649,"new":1},
			{"id":"470279","sender":"sys","title":"Famine happens in Castle [185\/53]!","time":1321913471,"new":0},{"id":"469881","sender":"sys","title":"NO Food in Castle [185\/53]!","time":1321889675,"new":1},{"id":"469772","sender":"sys","title":"Eliminated by [Led] adam in PVP","time":1321886003,"new":1},{"id":"468104","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321842417,"new":1},
			{"id":"468103","sender":"\uae40\uc120\uc9c4","title":"24\uc77c \ubaa9\uc694\uc77c 18\uc2dc \ud734\uc804\ud574\uc81c","time":1321838344,"new":0},{"id":"467545","sender":"sys","title":"[185\/53]\uc131 \ub0b4\uc5d0 \uc2dd\ub7c9\uc774 \uc5c6\uc2b5\ub2c8\ub2e4!","time":1321829813,"new":1},{"id":"466090","sender":"sys","title":"Resource Colony 4\/72 is expired","time":1321791198,"new":1},{"id":"467552","sender":"\ud751\uc778","title":"\ud751\uc778\ub18d\uc7a5 \uc0ac\uc6a9\ubc29\ubc95","time":1321762518,"new":0},
			{"id":"467551","sender":"\ud751\uc778","title":"\ud751\uc778\ub18d\uc7a5 \uc0ac\uc6a9\ubc29\ubc95","time":1321762510,"new":0},{"id":"467550","sender":"\uae40\uc120\uc9c4","title":"\uc0ac\uce6d\uc8fc\uc758","time":1321762288,"new":0},{"id":"467549","sender":"\ud751\uc778","title":"\uc8fc \ud751\uc778\ub18d\uc7a5\uac1c\uc5c5 \uc0ac\uc6a9\ubc29\ubc95","time":1321762278,"new":0},{"id":"467548","sender":"\ud751\uc778","title":"(\uc8fc) \ud751\uc778\ub18d\uc7a5 \uac1c\uc5c5","time":1321762183,"new":0},{"id":"467547","sender":"\ud751\uc778","title":"\ub2e4\ub4e4 \uc218\uc1a1\ud301 \ub2e4\uc2dc-\ucd5c\uc885\uc801","time":1321759625,"new":0},{"id":"467546","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321755594,"new":1},{"id":"462487","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321680488,"new":1},{"id":"462486","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321677413,"new":1},{"id":"462485","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321675795,"new":1},
			{"id":"462484","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321675492,"new":1}
			],
			"max":2}})
*/


/*

/war_result_list_api.php?
jsonpcallback=jsonp1321974261722&_=1321974489374&key=a0ec2950f34992bd4d5db145cfea95d3
&page=1
&type=3
&_l=en
&_p=EW-DROID


jsonp1321974261722(
{"code":0,
	"ret":
		{"war":
			[
			{"id":3276196, // id !! 
				"type":3,"aid":3074,"did":0,"aname":"james!!","dname":null,
				"acid":3070,"dcid":0,
					"acity":"\ucc9c\uc0c1\uc131",
					"dcity":"\ucc9c\uc0c1\uc131",
					"ax":185,"ay":53,
					
					"dx":184,"dy":53, // coodi 

					"flag":1,
					"time":1321974150,
					"new":1}
			],"max":1}})
*/


/*

war_result_info_api.php?
jsonpcallback=jsonp1321974261723&_=1321974497945&key=a0ec2950f34992bd4d5db145cfea95d3
&id=3276196		// id
&_l=en
&_p=EW-DROID



// Horror(694)
jsonp1321974261723({
"code":0,
"ret":
	{
		"war_report":null,
		"scout_report":
			{"flag":0,
			"result":
			"<b>[Hero]<\/b><br\/>ChaosSlave (Lvl.3)<br\/><br\/><b>[Troops]<\/b><br\/>Horror(694)<br>Attack(15)&nbsp;&nbsp;Defense(8)&nbsp;&nbsp;Health(80)<br><br>"},
			"other_report":null}})
*/


/*
api_fav.php?
jsonpcallback=jsonp1321974261724&_=1321974513522&key=a0ec2950f34992bd4d5db145cfea95d3
&act=addreport
&wid=3276196&cat=2
&_l=en&_p=EW-DROID

jsonp1321974261757(
{"code":0,"ret":""}
)
*/



/*   ATT
	
	// Sel  co odi 
armament_action_do_api.php?
jsonpcallback=jsonp1322055723836&_=1322055842519&key=3badb54bda7e38920062ad493d1c9944
&city=14281
&act=anum
&x=204&y=251
&_l=en 

{"code":0,"ret":1}

//  go att 
armament_action_do_api.php?
jsonpcallback=jsonp1322055723839&_=1322055884101&key=3badb54bda7e38920062ad493d1c9944
&city=14281
&action=do_war
&attack_type=7
&gen=185
&area=204&area_x=251
&soldier_num2=33
&_l=en 


{"code":0,"ret":{"carry":1980,"cost_food":1980,"cost_wood":0,"cost_iron":0,"cost_gold":0,"distance":2160,"travel_sec":300}}



// go confirm with cost 
 armament_action_task_api.php?
 jsonpcallback=jsonp1322055723840&_=1322055886719&key=3badb54bda7e38920062ad493d1c9944
 &city=14281
 &action=war_task
 &attack_type=7
 &gen=185
 &area=204&area_x=251
 &soldier_num2=33
 &_l=en
 &carry=1980&cost_food=1980&cost_wood=0&cost_iron=0&cost_gold=0&distance=2160&travel_sec=300 


{"code":0,"ret":{"cd":[{"id":3321647,"cdtype":4,"target":7,"owner":185,"secs":300,"ret":0,"ext":"204\/251"}]}}
	
*/

 

 

 

 

 

 

 


// check rsult ::: Scan

/*
message_api.php?
jsonpcallback=jsonp1321974261721&_=1321974484078&key=a0ec2950f34992bd4d5db145cfea95d3
&page=1
&_l=en
&_p=EW-DROID


jsonp1321974261721(
{"code":0,
"ret":
{"mail":
[
{"id":"473273","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321968210,"new":1},{"id":"471036","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09\uc2dc\uac04 \u2605\u2605","time":1321925649,"new":1},
{"id":"470279","sender":"sys","title":"Famine happens in Castle [185\/53]!","time":1321913471,"new":0},{"id":"469881","sender":"sys","title":"NO Food in Castle [185\/53]!","time":1321889675,"new":1},{"id":"469772","sender":"sys","title":"Eliminated by [Led] adam in PVP","time":1321886003,"new":1},{"id":"468104","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321842417,"new":1},
{"id":"468103","sender":"\uae40\uc120\uc9c4","title":"24\uc77c \ubaa9\uc694\uc77c 18\uc2dc \ud734\uc804\ud574\uc81c","time":1321838344,"new":0},{"id":"467545","sender":"sys","title":"[185\/53]\uc131 \ub0b4\uc5d0 \uc2dd\ub7c9\uc774 \uc5c6\uc2b5\ub2c8\ub2e4!","time":1321829813,"new":1},{"id":"466090","sender":"sys","title":"Resource Colony 4\/72 is expired","time":1321791198,"new":1},{"id":"467552","sender":"\ud751\uc778","title":"\ud751\uc778\ub18d\uc7a5 \uc0ac\uc6a9\ubc29\ubc95","time":1321762518,"new":0},
{"id":"467551","sender":"\ud751\uc778","title":"\ud751\uc778\ub18d\uc7a5 \uc0ac\uc6a9\ubc29\ubc95","time":1321762510,"new":0},{"id":"467550","sender":"\uae40\uc120\uc9c4","title":"\uc0ac\uce6d\uc8fc\uc758","time":1321762288,"new":0},{"id":"467549","sender":"\ud751\uc778","title":"\uc8fc \ud751\uc778\ub18d\uc7a5\uac1c\uc5c5 \uc0ac\uc6a9\ubc29\ubc95","time":1321762278,"new":0},{"id":"467548","sender":"\ud751\uc778","title":"(\uc8fc) \ud751\uc778\ub18d\uc7a5 \uac1c\uc5c5","time":1321762183,"new":0},{"id":"467547","sender":"\ud751\uc778","title":"\ub2e4\ub4e4 \uc218\uc1a1\ud301 \ub2e4\uc2dc-\ucd5c\uc885\uc801","time":1321759625,"new":0},{"id":"467546","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321755594,"new":1},{"id":"462487","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321680488,"new":1},{"id":"462486","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321677413,"new":1},{"id":"462485","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321675795,"new":1},
{"id":"462484","sender":"sys","title":"\u2605\u2605 \uacc4\uc88c\uc774\uccb4 \uc82c \uad6c\ub9e4 \ubc29\ubc95 \/ \uc9c0\uae09 \uc2dc\uac04 \u2605\u2605","time":1321675492,"new":1}
],
"max":2}})
*/


/*

/war_result_list_api.php?
jsonpcallback=jsonp1321974261722&_=1321974489374&key=a0ec2950f34992bd4d5db145cfea95d3
&page=1
&type=3
&_l=en
&_p=EW-DROID


jsonp1321974261722(
{"code":0,
"ret":
{"war":
[
{"id":3276196, // id !! 
"type":3,"aid":3074,"did":0,"aname":"james!!","dname":null,
"acid":3070,"dcid":0,
"acity":"\ucc9c\uc0c1\uc131",
"dcity":"\ucc9c\uc0c1\uc131",
"ax":185,"ay":53,

"dx":184,"dy":53, // coodi

"flag":1,
"time":1321974150,
"new":1}
],"max":1}})
*/


/*

war_result_info_api.php?
jsonpcallback=jsonp1321974261723&_=1321974497945&key=a0ec2950f34992bd4d5db145cfea95d3
&id=3276196 // id
&_l=en
&_p=EW-DROID

 

// Horror(694)
jsonp1321974261723({
"code":0,
"ret":
{
"war_report":null,
"scout_report":
{"flag":0,
"result":
"<b>[Hero]<\/b><br\/>ChaosSlave (Lvl.3)<br\/><br\/><b>[Troops]<\/b><br\/>Horror(694)<br>Attack(15)&nbsp;&nbsp;Defense(8)&nbsp;&nbsp;Health(80)<br><br>"},
"other_report":null}})
*/
